package com.yanxu;

import com.yanxu.customsink.Event;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2025-06-24-2025
 * @Description: 这里用一句话描述这个类的作用
 */
public class TestSource {
    public static void main(String[] args) {
        // 创建并获取Flink流处理执行环境，设置并行度为1
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        // 1. 创建数据源流，模拟产生Event对象的数据流
        //DataStreamSource<Event> dataStreamSource = env.fromElements(
        SingleOutputStreamOperator<Event> eventStream = env.fromElements(
                // 生成几个示例Event对象
                new Event("Alice", "./home", 1000L),
                new Event("Bob", "./cart", 1000L),
                new Event("Alice", "./prod?id=1", 5 * 1000L),
                new Event("Cary", "./home", 60 * 1000L),
                new Event("Bob", "./prod?id=3", 90 * 1000L),
                new Event("Alice", "./prod?id=7", 105 * 1000L)
        );

    }
}